﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MC.RideEvent.Mvc.Models.Repository;

namespace MC.RideEvent.Mvc.Controllers
{
    public class VehiculeBrandController : ControllerBase
    {
        private IVehiculeBrandRepository _BrandRepo;
        private IVehiculeModelRepository _ModelRepo;

        public VehiculeBrandController(IVehiculeBrandRepository brandRepo, IVehiculeModelRepository modelRepo)
        {
            _BrandRepo = brandRepo;
            _ModelRepo = modelRepo;
        }

        public ActionResult Brands()
        {
            var list = _BrandRepo.ListBrand();

            return Json(list, JsonRequestBehavior.AllowGet);
        }

        public ActionResult Models(int brandId)
        {
            var list = _ModelRepo.ListModelByBrandId(brandId);

            return Json(list, JsonRequestBehavior.AllowGet);
        }
    }
}
